﻿@{
    Layout = null;
}
@model LoginModel
<!DOCTYPE html>

<html>
<head>
    <title>系统登录</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="~/lib/twitter-bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="~/lib/font-awesome/css/fontawesome.css">
    <link rel="stylesheet" href="~/lib/admin-lte/css/AdminLTE.css">
    <link rel="stylesheet" href="~/lib/iCheck/skins/square/blue.css">
</head>
<body class="hold-transition login-page">
    <div class="login-box">

        <div class="login-logo">
            <a href="http://fonour.cnblogs.com" target="_blank"><b>Fonour</b></a>
        </div>
        <!-- /.login-logo -->
        <div class="login-box-body">
            <p class="login-box-msg">权限管理系统</p>

            <input id="errorInfo" type="hidden" value="@ViewBag.ErrorInfo" />

            <form asp-controller="Login" asp-action="Index" method="post" onsubmit="onSubmit()">

                <div class="form-group has-feedback">
                    <input type="text" class="form-control" placeholder="用户名" asp-for="UserName">

                    <span class="glyphicon glyphicon-user form-control-feedback"></span>
                    @*<span asp-validation-for="UserName" class="text-danger"></span>*@
                </div>
                <div class="form-group has-feedback">
                    <input type="password" class="form-control" placeholder="密码" asp-for="Password">
                    <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                    @*<span asp-validation-for="Password" class="text-danger"></span>*@
                </div>
                <div class="row">
                    <div class="col-md-8 col-sm-8">
                        <div class="checkbox icheck">
                            <label>
                                <input type="checkbox" asp-for="RememberMe" id="RememberMe"> 记住我
                            </label>
                        </div>
                    </div>
                    <!-- /.col -->
                    <div class="col-md-4 col-sm-8">
                        <button type="submit" class="btn btn-primary btn-block btn-flat" id="btnLogin">登录</button>
                    </div>
                    <!-- /.col -->
                </div>
            </form>
        </div>
        <!-- /.login-box-body -->
    </div>
    <!-- /.login-box -->
    <script src="~/lib/jquery/jquery.js"></script>

    <script src="~/lib/twitter-bootstrap/js/bootstrap.min.js"></script>

    <script src="~/lib/iCheck/icheck.js"></script>
    <script src="lib/layer/layer.js"></script>
    <script src="lib/jquery-cookie/jquery.cookie.js"></script>
    <script>
        $(function () {
            $('input').iCheck({
                checkboxClass: 'icheckbox_square-blue',
                radioClass: 'iradio_square-blue',
                increaseArea: '20%' // optional
            });
            if ($("#errorInfo").val()) {
                layer.tips($("#errorInfo").val(), "#btnLogin");
            }
            if ($.cookie("fonour_userName") != undefined) {
                $("#RememberMe").attr("checked", "checked");
            } else
            {
                $("#RememberMe").removeAttr("checked");
            }
            if ($("#RememberMe:checked").length > 0) {
                $("#UserName").val($.cookie("fonour_userName"));
                $("#Password").val($.cookie("fonour_password"));
            }

        });

        function onSubmit() {
            if ($("#RememberMe:checked").length > 0) {
                $.cookie("fonour_userName", $("#UserName").val());
                $.cookie("fonour_password", $("#Password").val());
            } else {
                $.removeCookie("fonour_userName");
                $.removeCookie("fonour_password");
            }
        }
    </script>
</body>
</html>